package com.example.controller;

import com.example.mall.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName OrderController
 * @Description TODO
 * @Author: XMK
 * @Date: 2020/4/29 15:23
 * @Version: 1.0
 */
@RestController
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/selectOrderById/{orderId}")
    public Object selectOrderById(@PathVariable String orderId) {
        System.out.println("orderId:::" + orderId);

        String url = "http://product-center/";

        return restTemplate.getForObject(url + "/selectProductByOrderId/" + orderId, Product.class);
    }

}
